import React, { Component } from 'react'
// 会vue2 ，vue3 ，react 类 react 函数
class Appson extends Component {
  state = {
      name:"zhangsan"
  }
  setname(){
    this.setState({
        name:"lisi" 
    },()=>{
        console.log(this.state.name)
    })
    // setTimeout(()=>{  console.log(this.state.name)},200)
  
  }
  render() {
    let { name } = this.state
    return (
      <div>{name}
      <button onClick={this.setname.bind(this)}>修改name</button>
      </div>
    )
  }
}

export default Appson